<!--{{files}}-->


<md-content layout-fill>
    <md-toolbar layout="row">
        <div class="md-toolbar-tools">
            <md-button ng-click="backToClass()">
                <md-icon class="material-icons">home</md-icon>
                菜单
            </md-button>
            <md-select ng-model="courseSelected" placeholder="选择班级"  layout-align="end end">
                <md-option ng-repeat="course in courseList" ng-click="switchCourse(course)">{{ course.name }}
                </md-option>
            </md-select>
        </div>
    </md-toolbar>
	<md-content layout-padding>
    <md-button ng-click="btnVideo(course._id)">
        <md-icon class="md-secondary material-icons">video_call</md-icon>
        <span>在当前课程视频聊天</span>
    </md-button>
    <md-subheader class="md-primary ">
        课程文件
			<md-button ng-click="btnUpdate()" class ="md-raised md-primary" >
			<md-icon class="material-icons">play_for_work</md-icon>
			<span>刷新文件</span>
				</md-button>
    </md-subheader>
    <md-card ng-repeat="file in files">
        <md-content layout-padding>
            <md-card-title>
                {{file.name}}
            </md-card-title>

            <img ng-src="{{getSrc(file.fileID,file.author)}}" ng-if="file.name.length>5&&
        (file.name.substr(file.name.lenght-4)=='.png'||file.name.substr(file.name.lenght-4)=='jpg'||file.name.substr(file.name.lenght-4)=='.jpeg'||file.name.substr(file.name.lenght-4)=='.BMP')">
            </img>
            <video controls preload="metadata" ng-src="{{getSrc(file.fileID,file.author)}}" controls ng-if="file.name.length>5&&
            (file.name.substr(file.name.lenght-4)=='.mp4'||file.name.substr(file.name.lenght-5)=='.webm')">
            </video>
            <br>
            <span ng-show="file.size/1024<1000">
        size:{{(file.size/1024).toFixed(3)}}KB<br>
        </span>
            <span ng-show="file.size/1024>=1000">
        size:{{(file.size/1024/1024).toFixed(3)}}MB<br>
         </span>
            <span>
        createdTime:{{file.createdTime|date:'medium'}}
    </span>
            <md-card-actions layout="row" layout-xs="column" layout-align="end end">
                <div layout-xs="row">
                    <!--<md-button ng-click="btnPlayFile(file.fileID)">-->
                    <!--<md-icon class="md-secondary material-icons">delete</md-icon>-->
                    <!--<span>play</span>-->
                    <!--</md-button>-->
                    <md-button ng-click="btnDownloadFile(file.fileID,file.author)">
                        <md-icon class="md-secondary material-icons">file_download</md-icon>
                        <span>下载</span>
                    </md-button>

                </div>
            </md-card-actions>
        </md-content>
    </md-card>


    <md-subheader class="md-primary">
        我的文件	
		<md-button ng-click="btnMyUpdate()" class ="md-raised md-primary" >
			<md-icon class="material-icons">play_for_work</md-icon>
			<span>刷新文件</span>
				</md-button>
    </md-subheader>
	    <md-content layout-padding>
    选择一个文件上传<input type="file" id="file">
    <md-progress-circular md-mode="indeterminate" ng-show="uploading"></md-progress-circular>
    </md-content>
    <md-card ng-repeat="file in studentfiles">
        <md-content layout-padding>
            <md-card-title>
                {{file.name}}
            </md-card-title>

            <img ng-src="{{getSrc(file.fileID,file.author)}}" ng-if="file.name.length>5&&
        (file.name.substr(file.name.lenght-4)=='.png'||file.name.substr(file.name.lenght-4)=='jpg'||file.name.substr(file.name.lenght-4)=='.jpeg'||file.name.substr(file.name.lenght-4)=='.BMP')">
            </img>
            <video controls preload="metadata" ng-src="{{getSrc(file.fileID,file.author)}}" controls ng-if="file.name.length>5&&
            (file.name.substr(file.name.lenght-4)=='.mp4'||file.name.substr(file.name.lenght-5)=='.webm')">
            </video>
            <br>
            <span ng-show="file.size/1024<1000">
        size:{{(file.size/1024).toFixed(3)}}KB<br>
        </span>
            <span ng-show="file.size/1024>=1000">
        size:{{(file.size/1024/1024).toFixed(3)}}MB<br>
         </span>
            <span>
        createdTime:{{file.createdTime|date:'medium'}}
    </span>
            <md-card-actions layout="row" layout-xs="column" layout-align="end end">
                <div layout-xs="row">
                    <md-button ng-click="btnDownloadFile(file.fileID , file.author)">
                        <md-icon class="md-secondary material-icons">file_download</md-icon>
                        <span>下载</span>
                    </md-button>
                    <md-button ng-click="btnRemoveFile(file)">
                        <md-icon class="md-secondary material-icons">delete</md-icon>
                        <span>删除</span>
                    </md-button>
                </div>
            </md-card-actions>
        </md-content>
    </md-card>
	</md-content>
</md-content>